﻿using xjjxmm.infrastructure.ToolKit.IdKit;
using XjjXmm.Message.Service.Model;

namespace XjjXmm.Message.Service.Subscriber;

public interface ISubscriber
{
   // Task<bool> Subscribe(string topic);

  //  Task<bool> Unsubscribe(string topic);

    Task<bool> Receive(string message);
}

public interface ISubscriberHandel
{
    Task<bool> Subscribe(string topic, string clientCode);

    Task<bool> Unsubscribe(string topic);
}


public class HttpSubscriberHandelService : ISubscriberHandel
{
    public HttpSubscriberHandelService()
    {
       
    }

    public Task<bool> Subscribe(string topic, string clientCode)
    {
        var entity = new SubscriberEntity
        {
            Id = SnowFlakeKit.NextIdStr(),
            Url = clientCode,
            CreateTime = DateTime.Now,
            TopicCode = topic
        };


    }

    public Task<bool> Unsubscribe(string topic)
    {
        throw new NotImplementedException();
    }
}